<template>
  <div class="dmform dmform-right" v-loading="loading">
    <Tabs default-active-key="1" tabPosition="left" :animated="false" :style="{height: pageHeight+'px'}">
      <TabPane label="基本信息">
        <div class="dmform-groups" :style="{maxHeight:pageHeight-50+'px'}" style="padding-top: 10px;">
          <a-form-model ref="form" :model="formData" :rules="formRules" :label-col="formLabelCol" :wrapper-col="formWrapperCol">
            <div class="dmform-group">
              <!--
                 prop="customerName"   //表单校验
                 v-model="formData.customerName" //Vue双向数据绑定
              -->
              <a-form-model-item prop="customerName" has-feedback label="企业名称" help="建议填写企业名称全称。">
                <a-input v-model="formData.customerName" v-focus />
              </a-form-model-item>
              <!--
                 prop="customerRegAddress"   //表单校验
                 v-model="formData.customerRegAddress" //Vue双向数据绑定
              -->
              <a-form-model-item prop="customerRegAddress" has-feedback label="企业住所" help="建议填写企业住所详细信息。格式：XX 省(市) XX 市(州) XX 区(县)。">
                <a-input v-model="formData.customerRegAddress" />
              </a-form-model-item>
              <!--
                 prop="projName"   //表单校验
                 v-model="formData.projName" //Vue双向数据绑定
              -->
              <a-form-model-item prop="projName" has-feedback label="项目名称" help="项目名称全称。">
                <a-input v-model="formData.projName" />
              </a-form-model-item>
               <!--
                 prop="projAddressName"   //表单校验
                 v-model="formData.projAddressName" //Vue双向数据绑定
              -->
              <a-form-model-item prop="projAddressName" has-feedback label="项目所在地" help="建议填写项目所在地详细信息。格式：XX 省(市) XX 市(州) XX 区(县)。">
                <a-input v-model="formData.projAddressName" />
              </a-form-model-item>
               <!--
                 prop="setupTime"   //表单校验
                 v-model="formData.setupTime" //Vue双向数据绑定
              -->
              <a-form-model-item prop="setupTime" has-feedback label="项目设立时间" help="项目设立时间。">
               <a-date-picker show-time placeholder="项目设立时间"  v-model="formData.setupTime"  />
              </a-form-model-item>
               <!--
                 prop="needAudit"   //表单校验
                 v-model="formData.needAudit" //Vue双向数据绑定
              -->
              <a-form-model-item prop="needAudit" has-feedback label="立项要否审批" help="立项要否审批">
                <a-select placeholder="立项要否审批"  style="width: 100%"
                           v-model="formData.needAudit">
                 <a-select-option value="1">是</a-select-option>
                 <a-select-option value="0">否</a-select-option>
                </a-select>
              </a-form-model-item>
               <!--
                 prop="securityCategory1"   //表单校验
                 v-model="formData.securityCategory1" //Vue双向数据绑定
              -->
              <!--引入：项目安全大类,单选 securityCategory.json 一级 【如果是树，使用a-tree-select】-->
              <a-form-model-item prop="securityCategory1" has-feedback label="项目安全大类" help="项目安全大类">
                <a-select placeholder="项目安全大类"  style="width: 100%"
                           v-model="formData.securityCategory1">
                 <a-select-option value="0">请实际引入类型数据[测试]</a-select-option>
                </a-select>
              </a-form-model-item>
               <!--
                 prop="securityCategory2"   //表单校验
                 v-model="formData.securityCategory2" //Vue双向数据绑定
              -->
               <!--引入：项目安全细类,级联单选 securityCategory.json 二级【如果是树，使用a-tree-select】-->
              <a-form-model-item prop="securityCategory2" has-feedback label="项目安全细类" help="项目安全细类">
                <a-select placeholder="项目安全细类"  style="width: 100%"
                           v-model="formData.securityCategory2">
                 <a-select-option value="0">请实际引入类型数据[测试]</a-select-option>
                </a-select>
              </a-form-model-item>
               <!--
                 ////后面的以此类推////
              -->
              <a-form-model-item prop="serviceRange" has-feedback label="项目技术服务范围" help="项目技术服务范围">
                <a-input v-model="formData.serviceRange" />
              </a-form-model-item>
               <!--引入：项目归属公司【如果是树，使用a-tree-select】-->
              <a-form-model-item prop="deptId" has-feedback label="项目归属公司" help="项目归属公司">
                <a-select placeholder="项目归属公司"  style="width: 100%"
                           v-model="formData.deptId">
                 <a-select-option value="0">请实际引入类型数据[测试]</a-select-option>
                </a-select>
              </a-form-model-item>
              <a-form-model-item prop="securityAwareStatus" has-feedback label="企业安全意识状况" help="企业安全意识状况">
                <a-select placeholder="企业安全意识状况"  style="width: 100%"
                           v-model="formData.securityAwareStatus">
                 <a-select-option value="1">优</a-select-option>
                 <a-select-option value="2">良</a-select-option>
                 <a-select-option value="3">一般</a-select-option>
                 <a-select-option value="4">差</a-select-option>
                </a-select>
              </a-form-model-item>
              <a-form-model-item prop="securityMngStatus" has-feedback label="企业安全管理状况" help="企业安全管理状况">
                <a-select placeholder="企业安全管理状况"  style="width: 100%"
                           v-model="formData.securityMngStatus">
                 <a-select-option value="1">优</a-select-option>
                 <a-select-option value="2">良</a-select-option>
                 <a-select-option value="3">一般</a-select-option>
                 <a-select-option value="4">差</a-select-option>
                </a-select>
              </a-form-model-item>
              <a-form-model-item prop="intendAmount" has-feedback label="项目合同意向金额(元)" help="项目合同意向金额(元)">
                <a-input-number v-model="formData.intendAmount" />
              </a-form-model-item>
              <a-form-model-item prop="psAmount" has-feedback label="含评审费（元）" help="含评审费（元）">
                <a-input-number v-model="formData.psAmount" />
              </a-form-model-item>
              <a-form-model-item prop="firstPayAmount" has-feedback label="首付款意向金额（元）" help="首付款意向金额（元）">
                <a-input-number v-model="formData.firstPayAmount" />
              </a-form-model-item>
              <a-form-model-item prop="coopTimes" has-feedback label="企业与公司合作次数" help="企业与公司合作次数">
                <a-select placeholder="企业与公司合作次数"  style="width: 100%"
                           v-model="formData.coopTimes">
                 <a-select-option value="0">0 次</a-select-option>
                 <a-select-option value="1">1 次</a-select-option>
                 <a-select-option value="9">多次</a-select-option>
                </a-select>
              </a-form-model-item>
              <a-form-model-item prop="investAmount" has-feedback label="企业项目投资额（元）" help="企业项目投资额（元）">
                <a-input-number v-model="formData.investAmount" />
              </a-form-model-item>
              <a-form-model-item prop="loanAmount" has-feedback label="项目贷款额（元）" help="项目贷款额（元）">
                <a-input-number v-model="formData.loanAmount" />
              </a-form-model-item>
              <a-form-model-item prop="gainStatus" has-feedback label="企业盈利状况" help="企业盈利状况">
                <a-select placeholder="企业盈利状况"  style="width: 100%"
                           v-model="formData.gainStatus">
                 <a-select-option value="1">盈利</a-select-option>
                 <a-select-option value="2">持平</a-select-option>
                 <a-select-option value="3">亏损</a-select-option>
                </a-select>
              </a-form-model-item>
              <a-form-model-item prop="creditStatus" has-feedback label="企业资信状况" help="企业资信状况">
                <a-select placeholder="企业资信状况"  style="width: 100%"
                           v-model="formData.creditStatus">
                 <a-select-option value="1">好</a-select-option>
                 <a-select-option value="2">一般</a-select-option>
                 <a-select-option value="3">差</a-select-option>
                </a-select>
              </a-form-model-item>
              <a-form-model-item prop="prospect" has-feedback label="项目发展前景" help="项目发展前景">
                <a-input v-model="formData.prospect" />
              </a-form-model-item>
              <a-form-model-item prop="enterTime" has-feedback label="要求进场时间" help="要求进场时间">
               <a-date-picker show-time placeholder="要求进场时间"  v-model="formData.enterTime"  />
              </a-form-model-item>
              <a-form-model-item prop="finishTime" has-feedback label="要求完成时间" help="要求完成时间">
               <a-date-picker show-time placeholder="要求完成时间"  v-model="formData.finishTime"  />
              </a-form-model-item>
              <a-form-model-item prop="sdTime" has-feedback label="项目上单时间" help="项目上单时间">
               <a-date-picker show-time placeholder="项目设立时间"  v-model="formData.sdTime"  />
              </a-form-model-item>
              <a-form-model-item prop="otherRequire" has-feedback label="合同要附加的企业其他 要求" help="合同要附加的企业其他 要求">
                <a-input v-model="formData.otherRequire" />
              </a-form-model-item>
              <a-form-model-item prop="reportReview" has-feedback label="报告是否评审" help="报告是否评审">
                <a-select placeholder="报告是否评审"  style="width: 100%"
                           v-model="formData.reportReview">
                 <a-select-option value="1">要评审</a-select-option>
                 <a-select-option value="2">不评审（出专家意见）</a-select-option>
                 <a-select-option value="3">不评审（直接终稿）</a-select-option>
                </a-select>
              </a-form-model-item>
              <a-form-model-item prop="reportMngUnit" has-feedback label="评审报告管辖单位" help="评审报告管辖单位">
                <a-select placeholder="评审报告管辖单位"  style="width: 100%"
                           v-model="formData.reportMngUnit">
                 <a-select-option value="1">总局</a-select-option>
                 <a-select-option value="2">省局</a-select-option>
                 <a-select-option value="3">州市局</a-select-option>
                 <a-select-option value="4">县区局</a-select-option>
                </a-select>
              </a-form-model-item>
            </div>           
          </a-form-model>
        </div>
        <div class="dmform-bottom">
          <a-button @click="doSubmit" type="primary" :loading="submitting">{{ saveButtonText }}</a-button>
        </div>
      </TabPane>
    </Tabs>
  </div>
</template>
<script>
import {Tabs,TabPane} from 'element-ui'
import DataFormUtils from '@/utils/DataFormUtils'

export default {
  //使用组件
  components: { Tabs, TabPane },
  //混入工具
  mixins: [DataFormUtils],
  data() {
    return {
      //后台服务地址-编辑回填->获取单条数据
      loadUrl: '/jsofted/project/get/',
      //后台服务地址-新增
      addUrl: '/jsofted/project/add',
      //后台服务地址-更新
      updateUrl: '/jsofted/project/update/',
      formData: {
        id: '',
        customerName: '',//企业名称
        customerRegAddress: '',//企业住所
        projName: '',//项目名称
        projAddressName: '',//项目所在地
        setupTime: '',//项目设立时间
        needAudit: '',//立项要否审批
        securityCategory1: '',//项目安全大类,单选 securityCategory.json 一级
        securityCategory2: '',//项目安全细类,级联单选 securityCategory.json 二级
        serviceRange: '',//项目技术服务范围
        deptId: '',//项目归属公司,关联机构表
        securityAwareStatus: '',//企业安全意识状况
        securityMngStatus: '',//企业安全管理状况
        intendAmount: '',//项目合同意向金额(元)
        psAmount: '',//含评审费（元）
        firstPayAmount: '',//首付款意向金额（元）
        coopTimes: '',//企业与公司合作次数
        investAmount: '',//企业项目投资额（元）
        loanAmount: '',//项目贷款额（元）
        gainStatus: '',//企业盈利状况
        creditStatus: '',//企业资信状况
        prospect: '',//项目发展前景
        enterTime: '',//要求进场时间
        finishTime: '',//要求完成时间
        sdTime: '',//项目上单时间
        otherRequire: '',//合同要附加的企业其他 要求
        reportReview: '',//报告是否评审
        reportMngUnit: '',//评审报告管辖单位
      },
      ////////////////////////////表单校验///////////////////////////
      formRules: {
        customerName: [
          { required: true, message: '不能为空！', trigger: 'change' },
          { min: 2, max: 64, message: '长度为2-64个字！', trigger: 'change' },
        ],
        customerRegAddress: [
          { required: true, message: '不能为空！', trigger: 'change' },
          { min: 2, max: 128, message: '长度为2-128个字！', trigger: 'change' },
        ],
        projName: [
          { required: true, message: '不能为空！', trigger: 'change' },
          { min: 2, max: 64, message: '长度为2-64个字！', trigger: 'change' },
        ],
        projAddressName: [
          { required: true, message: '不能为空！', trigger: 'change' },
          { min: 2, max: 128, message: '长度为2-128个字！', trigger: 'change' },
        ],
        setupTime: [
          { required: true, message: '不能为空！', trigger: 'change' },
        ],
        needAudit: [
          { required: true, message: '不能为空！', trigger: 'change' },
        ],
        securityCategory1: [
          { required: true, message: '不能为空！', trigger: 'change' },
        ],
        securityCategory2: [
          { required: true, message: '不能为空！', trigger: 'change' },
        ],
        serviceRange: [
          { required: true, message: '不能为空！', trigger: 'change' },
          { min: 2, max: 512, message: '长度为2-512个字！', trigger: 'change' },
        ],
        deptId: [
          { required: true, message: '不能为空！', trigger: 'change' },
        ],
        securityAwareStatus: [
          { required: true, message: '不能为空！', trigger: 'change' },
        ],
        securityMngStatus: [
          { required: true, message: '不能为空！', trigger: 'change' },
        ],
        intendAmount: [
          { required: true, message: '不能为空！', trigger: 'change' },
        ],
        psAmount: [
          { required: true, message: '不能为空！', trigger: 'change' },
        ],
        firstPayAmount: [
          { required: true, message: '不能为空！', trigger: 'change' },
        ],
        coopTimes: [
          { required: true, message: '不能为空！', trigger: 'change' },
        ],
        investAmount: [
          { required: true, message: '不能为空！', trigger: 'change' },
        ],
        loanAmount: [
          { required: true, message: '不能为空！', trigger: 'change' },
        ],
        gainStatus: [
          { required: true, message: '不能为空！', trigger: 'change' },
        ],
        creditStatus: [
          { required: true, message: '不能为空！', trigger: 'change' },
        ],
        prospect: [
          { required: true, message: '不能为空！', trigger: 'change' },
          { min: 2, max: 512, message: '长度为2-512个字！', trigger: 'change' },
        ],
        enterTime: [
          { required: true, message: '不能为空！', trigger: 'change' },
        ],
        finishTime: [
          { required: true, message: '不能为空！', trigger: 'change' },
        ],
        sdTime: [
          { required: true, message: '不能为空！', trigger: 'change' },
        ],
        otherRequire: [
          { required: true, message: '不能为空！', trigger: 'change' },
          { min: 2, max: 512, message: '长度为2-512个字！', trigger: 'change' },
        ],
        reportReview: [
          { required: true, message: '不能为空！', trigger: 'change' },
        ],
        reportMngUnit: [
          { required: true, message: '不能为空！', trigger: 'change' },
        ],
      },
    }
  },
  computed: {
    
  },
  watch: {
    
  },
  methods: {
    //编辑时候初始化数据
    initFormData(obj) {
      obj = obj || {}
      this.formData.id = obj.id || ''
      this.formData.customerName = obj.customerName ||  ''//企业名称
      this.formData.customerRegAddress = obj.customerRegAddress ||  ''//企业住所
      this.formData.projName = obj.projName ||  ''//项目名称
      this.formData.projAddressName = obj.projAddressName ||  ''//项目所在地
      this.formData.setupTime = obj.setupTime ||  ''//项目设立时间
      this.formData.needAudit = obj.needAudit ||  ''//立项要否审批
      this.formData.securityCategory1 = obj.securityCategory1 ||  ''//项目安全大类,单选 securityCategory.json 一级
      this.formData.securityCategory2 = obj.securityCategory2 ||  ''//项目安全细类,级联单选 securityCategory.json 二级
      this.formData.serviceRange = obj.serviceRange ||  ''//项目技术服务范围
      this.formData.deptId = obj.deptId ||  ''//项目归属公司,关联机构表
      this.formData.securityAwareStatus = obj.securityAwareStatus ||  ''//企业安全意识状况
      this.formData.securityMngStatus = obj.securityMngStatus ||  ''//企业安全管理状况
      this.formData.intendAmount = obj.intendAmount ||  ''//项目合同意向金额(元)
      this.formData.psAmount = obj.psAmount ||  ''//含评审费（元）
      this.formData.firstPayAmount = obj.firstPayAmount ||  ''//首付款意向金额（元）
      this.formData.coopTimes = obj.coopTimes ||  ''//企业与公司合作次数
      this.formData.investAmount = obj.investAmount ||  ''//企业项目投资额（元）
      this.formData.loanAmount = obj.loanAmount ||  ''//项目贷款额（元）
      this.formData.gainStatus = obj.gainStatus ||  ''//企业盈利状况
      this.formData.creditStatus = obj.creditStatus ||  ''//企业资信状况
      this.formData.prospect = obj.prospect ||  ''//项目发展前景
      this.formData.enterTime = obj.enterTime ||  ''//要求进场时间
      this.formData.finishTime = obj.finishTime ||  ''//要求完成时间
      this.formData.sdTime = obj.sdTime ||  ''//项目上单时间
      this.formData.otherRequire = obj.otherRequire ||  ''//合同要附加的企业其他 要求
      this.formData.reportReview = obj.reportReview ||  ''//报告是否评审
      this.formData.reportMngUnit = obj.reportMngUnit ||  ''//评审报告管辖单位

    },
    
  }
}
</script>
